All Questions
10 questions
1vote
2answers
3kviews
Add Properties from one array of Objects to another array of Objects based on property id
I do have my code running but again I'm wondering if there is a nicer solution since mine seems to be clumsy and I'm wondering if there is a better way like chaining (but I can't work out how to do ...
11votes
4answers
3kviews
Restructuring JSON to create a new JSON where properties are grouped according to similar values
I have a JSON structure in the following example format: ...
6votes
1answer
357views
JavaScript: A drawing program in OOP
I made a little drawing program in OOP. The game consists of a canvas which is basically a 2d array where the user can draw various shapes on it. There can be multiple shapes overlapped on top of each ...
4votes
2answers
301views
Maxcounters in JavaScript
I am trying to solve this question: MaxCounters. Solving it is straightforward, but solving it fast enough is proving very difficult. How can I improve the performance of this code? At the moment it ...
2votes
2answers
156views
Divide the last element in an array of arrays among the remaining elements
The function below is part of an overall chunk of code to partition an array of size M into sub-arrays of size N. The function in question is written to handle the case: what if M isn't divisible by ...
1vote
1answer
53views
2votes
2answers
1kviews
Iterating through two objects with different structures in parallel
I have two objects, one input = Array<Type> and one stored = Array<{..., Type}> What's the best (cleanest) way to ...
1vote
4answers
723views
Find value that occurs in odd number of elements
I am trying to solve the following exercise using Javascript: A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be ...
7votes
5answers
4kviews
Find number repeated odd times in array
I completed the following exercise: You are given an array of repeating numbers. All numbers repeat in an even way, except for one. Find that odd occurring number. ...
2votes
4answers
158views
Formatting a list with commas and occasional line breaks
I have an array mapped to make a typical result string separated by commas and with numbers a bit beautified with array.map(formatNumber). Expected format is <...